package com.laich.springcloud.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.laich.springcloud.entity.User;
import com.laich.springcloud.feign.RemoteUserService;

@RestController
public class OrderController {
	
	@Autowired
	RemoteUserService remoteUserService;
	
	 @GetMapping("/getUser/{id}")
	    public User getUser(@PathVariable String id) {
	        //for debug
	        return remoteUserService.getUser(id);
	    }

	    @GetMapping("/order/{id}")
	    public String getOrder(@PathVariable String id) {
	        //for debug
	        return "order id : " + id;
	    }
	    
	    @GetMapping("/orderUser/{username}")
	    public User orderUser(@PathVariable String username) {
	        //for debug
	    	User user = remoteUserService.findByUserName(username);
	        return user;
	    }
}
